<?php
	include_once dirname(dirname(dirname(__FILE__))).'/inc/bootConfig.php';
	include_once '../checkLogin.php';
	if(isset($_POST['edit_content'])){
		$dir = "../../zjx/Runtime/Cache/selectModel/"; //缓存路径
			$imagename = date('YmdHis').'.jpg'; //图片名称
			$id = getRequest('id');
			$upd['b_webtitle'] = getRequest('title');
			$upd['b_comname'] = getRequest('name');
			$upd['b_url'] = getRequest('url');
			$upd['b_adminemail'] = getRequest('email');
			$upd['b_webcode'] = getRequest('webcode');
			$upd['b_statcode'] = addslashes($_REQUEST['statcode']);
			$upd['b_state'] = getRequest('state');
			$upd['b_closeinfo'] = getRequest('closeinfo');
			$upd['b_addr'] = getRequest('addr');
			$upd['b_phone'] = getRequest('phone');
			$upd['b_upduser'] = $_SESSION['username'];
			$upd['b_updtime'] = date('Y-m-d H:i:s');
			$tablename = 'zjx_basicinfo';
			if(!empty($id)){
				if(Module_Edit::update($tablename,$upd,'b_id='.$id)){
					Cache_Filecache::delFileCache($dir);
					jstop('修改成功');
				}
			}else{
				if(Module_Edit::insert($tablename,$upd)){
					Cache_Filecache::delFileCache($dir);
					jstop('修改成功');
				}
			}
			jstop('系统繁忙，请重试');
	}
	
	$webinfo= Module_Select::getWebAllInfo();
//	var_dump($webinfo);
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>站点信息管理</title>
<link rel="stylesheet" type='text/css'
	href='../Public/static/css/admincp/admincp.css'>
</head>
<body>
<div id="cpcontainer" class="container">
<div class="itemtitle">
<h3>站点信息</h3>
</div>
<form action="" method="post" id='form'>
<input type='hidden' name='id' value='<?php echo $webinfo['b_id']?>'>
<table class="tb tb2 ">
	<tbody>
		<tr">
			<td s="1" class="td27" colspan="2">站点名称:</td>
		</tr>
		<tr " class="noborder">
			<td class="vtop rowform"><input type="text" class="txt"
				value="<?php echo $webinfo['b_webtitle']?>" name="title"></td>
			<td s="1" class="vtop tips2">站点名称，将显示在浏览器窗口标题等位置</td>
		</tr>
		<tr>
			<td s="1" class="td27" colspan="2">公司名称:</td>
		</tr>
		<tr class="noborder">
			<td class="vtop rowform"><input type="text" class="txt"
				value="<?php echo $webinfo['b_comname']?>" name="name"></td>
			<td s="1" class="vtop tips2">公司名称，将显示在页面底部的联系方式处</td>
		</tr>
		<tr>
			<td s="1" class="td27" colspan="2">公司地址:</td>
		</tr>
		<tr class="noborder">
			<td class="vtop rowform"><input type="text" class="txt"
				value="<?php echo $webinfo['b_addr']?>" name="addr"></td>
			<td s="1" class="vtop tips2">公司地址，将显示在页面底部</td>
		</tr>
		<tr>
			<td s="1" class="td27" colspan="2">公司联系电话:</td>
		</tr>
		<tr class="noborder">
			<td class="vtop rowform"><input type="text" class="txt"
				value="<?php echo $webinfo['b_phone']?>" name="phone"></td>
			<td s="1" class="vtop tips2">联系电话，将显示在页面底部</td>
		</tr>
		<tr>
			<td s="1" class="td27" colspan="2">网站 URL:</td>
		</tr>
		<tr class="noborder">
			<td class="vtop rowform"><input type="text" class="txt"
				value="<?php echo $webinfo['b_url']?>" name="url"></td>
			<td s="1" class="vtop tips2">网站 URL，将作为链接显示在页面底部</td>
		</tr>
		<tr>
			<td s="1" class="td27" colspan="2">管理员邮箱:</td>
		</tr>
		<tr class="noborder">
			<td class="vtop rowform"><input type="text" class="txt"
				value="<?php echo $webinfo['b_adminemail']?>" name="email"></td>
			<td s="1" class="vtop tips2">管理员 E-mail，将作为系统发邮件的时候的发件人地址</td>
		</tr>
		<tr>
			<td s="1" class="td27" colspan="2">网站备案信息代码:</td>
		</tr>
		<tr class="noborder">
			<td class="vtop rowform"><input type="text" class="txt"
				value="<?php echo $webinfo['b_webcode']?>" name="webcode"></td>
			<td s="1" class="vtop tips2">页面底部可以显示 ICP
			备案信息，如果网站已备案，在此输入您的授权码，它将显示在页面底部，如果没有请留空</td>
		</tr>
		<tr>
			<td s="1" class="td27" colspan="2">网站第三方统计代码:</td>
		</tr>
		<tr class="noborder">
			<td class="vtop rowform"><textarea class="tarea" cols="50"
				name="statcode" onkeyup="textareasize(this, 0)"
				ondblclick="textareasize(this, 1)" rows="6"><?php echo $webinfo['b_statcode']?></textarea></td>
			<td s="1" class="vtop tips2">页面底部可以显示第三方统计<br>
			双击输入框可扩大/缩小</td>
		</tr>
	</tbody>
</table>

<table class="tb tb2 ">
	<tbody>
		<tr>
			<th class="partition" colspan="15">关闭站点</th>
		</tr>
		<tr>
			<td s="1" class="td27" colspan="2">关闭站点:</td>
		</tr>
		<tr class="noborder">
			<td class="vtop rowform">
			<ul>
				<li><input type="radio" value="1"
					<?php if($webinfo['b_state']==1)echo ' checked="" '?> name="state"
					class="radio">&nbsp;是</li>
				<li class="checked"><input type="radio"
					<?php if($webinfo['b_state']!=1)echo ' checked="" '?> value="0"
					name="state" class="radio">&nbsp;否</li>
			</ul>
			</td>
			<td s="1" class="vtop tips2">暂时将站点关闭，其他人无法访问，但不影响管理员访问</td>
		</tr>
	</tbody>
	<?php if($webinfo['b_state']==1){$flag='';}else{$flag='none';}?>
	<tbody style="display:<?php echo $flag;?>" id="hidden_setting_basic_bbclosed" class="sub">
		<tr>
			<td s="1" class="td27" colspan="2">关闭站点的原因:</td>
		</tr>
		<tr class="noborder">
			<td class="vtop rowform"><textarea class="tarea" cols="50" name="closeinfo"
				onkeyup="textareasize(this, 0)" ondblclick="textareasize(this, 1)"
				rows="6"><?php echo $webinfo['b_closeinfo']?></textarea></td>
			<td s="1" class="vtop tips2">站点关闭时出现的提示信息<br>
			双击输入框可扩大/缩小</td>
		</tr>
	</tbody>
	<tbody>
		<tr>
			<td colspan="15">
			<div class="fixsel"><input type="submit" value="提交"
				title="按 Enter 键可随时提交您的修改" name="edit_content"
				id="submit_settingsubmit" class="btn"></div>
			</td>
		</tr>
	</tbody>
</table>
</form>

</div>
</body>
</html>
<script src="/www/static/js/jquery.js" type='text/javascript'></script>
<script type="text/javascript">
$('input[name="state"]').click(function(){
	if($(this).val() == 1){
		$('#hidden_setting_basic_bbclosed').show();
	}else{
		$('#hidden_setting_basic_bbclosed').hide();
	}
})
var key = $('#form').serialize();
$('input[name="edit_content"]').click(function(){
	if(key == $('#form').serialize()){
		alert('您没有修改任何东西');
		return false;
	}
})
var BROWSER = {};
if(BROWSER.safari) {
	BROWSER.firefox = true;
}
BROWSER.opera = BROWSER.opera ? opera.version() : 0;

function textareasize(obj, op) {
	if(!op) {
		if(obj.scrollHeight > 70) {
			obj.style.height = (obj.scrollHeight < 300 ? obj.scrollHeight + obj.style.height: 300) + 'px';
			if(obj.style.position == 'absolute') {
				obj.parentNode.style.height = (parseInt(obj.style.height) + 20) + 'px';
			}
		}
	} else {
		if(obj.style.position == 'absolute') {
			obj.style.position = '';
			obj.style.width = '';
			obj.parentNode.style.height = '';
		} else {
			obj.parentNode.style.height = obj.parentNode.offsetHeight + 'px';
			obj.style.width = '700px';
			obj.style.position = 'absolute';
		}
	}
}
</script>